home *** CD-ROM | disk | FTP | other *** search
- class FPUI.DataProvider
- {
- var m_items = null;
- var m_views = null;
- var m_uniqueID = 0;
- function DataProvider()
- {
- this.m_items = new Array();
- this.m_views = new Array();
- }
- function addView(viewRef)
- {
- this.m_views.push(viewRef);
- viewRef.dataViewModelChanged();
- }
- function removeView(viewRef)
- {
- var _loc1_ = this;
- var _loc2_ = viewRef;
- for(var _loc3_ in _loc1_.m_views)
- {
- if(_loc1_.m_views[_loc3_] == _loc2_)
- {
- _loc1_.m_views[_loc3_] = null;
- }
- }
- _loc2_.dataViewModelChanged();
- }
- function addItemAt(index, value)
- {
- var _loc1_ = this;
- var _loc2_ = index;
- if(_loc2_ < _loc1_.getLength())
- {
- _loc1_.m_items.splice(_loc2_,0,false);
- }
- _loc1_.m_items[_loc2_] = value;
- _loc1_.updateViews();
- }
- function removeItemsAt(index, count)
- {
- if(count > 0)
- {
- this.m_items.splice(index,count);
- }
- this.updateViews();
- }
- function removeAll()
- {
- this.m_items = new Array();
- this.updateViews();
- }
- function getLength()
- {
- return this.m_items.length;
- }
- function getItemAt(index)
- {
- return this.m_items[index];
- }
- function updateViews()
- {
- var _loc3_ = this;
- var _loc1_ = 0;
- while(_loc1_ < _loc3_.m_views.length)
- {
- var _loc2_ = _loc3_.m_views[_loc1_];
- if(_loc2_)
- {
- _loc2_.dataViewModelChanged();
- }
- _loc1_ = _loc1_ + 1;
- }
- }
- }
-